// source --> https://h-magonotedo.com/wp-content/plugins/jetpack/modules/related-posts/related-posts.js?ver=20150408 /* jshint onevar: false */ /* globals related_posts_js_options */ /** * Load related posts */ (function($) { var jprp = { response: null, /** * Utility get related posts JSON endpoint from URLs * * @param {string} URL (optional) * @return {string} Endpoint URL */ getEndpointURL: function( URL ) { var locationObject, is_customizer = 'undefined' !== typeof wp && wp.customize && wp.customize.settings && wp.customize.settings.url && wp.customize.settings.url.self; // If we're in Customizer, write the correct URL. if ( is_customizer ) { locationObject = document.createElement( 'a' ); locationObject.href = wp.customize.settings.url.self; } else { locationObject = document.location; } if ( 'string' === typeof( URL ) && URL.match( /^https?:\/\// ) ) { locationObject = document.createElement( 'a' ); locationObject.href = URL; } var args = 'relatedposts=1'; if ( $( '#jp-relatedposts' ).data( 'exclude' ) ) { args += '&relatedposts_exclude=' + $( '#jp-relatedposts' ).data( 'exclude' ); } if ( is_customizer ) { args += '&jetpackrpcustomize=1'; } var pathname = locationObject.pathname; if ( '/' !== pathname[0] ) { pathname = '/' + pathname; } if ( '' === locationObject.search ) { return pathname + '?' + args; } else { return pathname + locationObject.search + '&' + args; } }, getAnchor: function( post, classNames ) { var anchor_title = post.title; if ( '' !== ( '' + post.excerpt ) ) { anchor_title += '\n\n' + post.excerpt; } var anchor = $( '' ); anchor.attr({ 'class': classNames, 'href': post.url, 'title': anchor_title, 'rel': post.rel, 'data-origin': post.url_meta.origin, 'data-position': post.url_meta.position }); var anchor_html = $( '
' ).append( anchor ).html(); return [ anchor_html.substring( 0, anchor_html.length-4 ), '' ]; }, generateMinimalHtml: function( posts, options ) { var self = this; var html = ''; $.each( posts, function( index, post ) { var anchor = self.getAnchor( post, 'jp-relatedposts-post-a' ); var classes = 'jp-relatedposts-post jp-relatedposts-post' + index; if ( post.classes.length > 0 ) { classes += ' ' + post.classes.join( ' ' ); } html += '

'; html += ''; if ( options.showDate ) { html += ''; } if ( options.showContext ) { html += ''; } html += '

'; } ); return ''; }, generateVisualHtml: function( posts, options ) { var self = this; var html = ''; $.each( posts, function( index, post ) { var anchor = self.getAnchor( post, 'jp-relatedposts-post-a' ); var classes = 'jp-relatedposts-post jp-relatedposts-post' + index; if ( post.classes.length > 0 ) { classes += ' ' + post.classes.join( ' ' ); } if ( ! post.img.src ) { classes += ' jp-relatedposts-post-nothumbs'; } else { classes += ' jp-relatedposts-post-thumbs'; } html += '
'; if ( post.img.src ) { html += anchor[0] + '' + anchor[1]; } else { var anchor_overlay = self.getAnchor( post, 'jp-relatedposts-post-a jp-relatedposts-post-aoverlay' ); html += anchor_overlay[0] + anchor_overlay[1]; } html += '<' + related_posts_js_options.post_heading + ' class="jp-relatedposts-post-title">' + anchor[0] + post.title + anchor[1] + ''; html += '

' ).text( post.excerpt ).html() + '

'; if ( options.showDate ) { html += ''; } if ( options.showContext ) { html += ''; } html += '
'; } ); return ''; }, /** * We want to set a max height on the excerpt however we want to set * this according to the natual pacing of the page as we never want to * cut off a line of text in the middle so we need to do some detective * work. */ setVisualExcerptHeights: function() { var elements = $( '#jp-relatedposts .jp-relatedposts-post-nothumbs .jp-relatedposts-post-excerpt' ); if ( 0 >= elements.length ) { return; } var fontSize = parseInt( elements.first().css( 'font-size' ), 10 ), lineHeight = parseInt( elements.first().css( 'line-height' ), 10 ); // Show 5 lines of text elements.css( 'max-height', ( 5 * lineHeight / fontSize ) + 'em' ); }, getTrackedUrl: function( anchor ) { var args = 'relatedposts_hit=1'; args += '&relatedposts_origin=' + $( anchor ).data( 'origin' ); args += '&relatedposts_position=' + $( anchor ).data( 'position' ); var pathname = anchor.pathname; if ( '/' !== pathname[0] ) { pathname = '/' + pathname; } if ( '' === anchor.search ) { return pathname + '?' + args; } else { return pathname + anchor.search + '&' + args; } }, cleanupTrackedUrl: function() { if ( 'function' !== typeof history.replaceState ) { return; } var cleaned_search = document.location.search.replace( /\brelatedposts_[a-z]+=[0-9]*&?\b/gi, '' ); if ( '?' === cleaned_search ) { cleaned_search = ''; } if ( document.location.search !== cleaned_search ) { history.replaceState( {}, document.title, document.location.pathname + cleaned_search ); } } }; /** * Initialize Related Posts. */ function startRelatedPosts() { jprp.cleanupTrackedUrl(); var endpointURL = jprp.getEndpointURL(), $relatedPosts = $( '#jp-relatedposts' ); $.getJSON( endpointURL, function( response ) { if ( 0 === response.items.length || 0 === $relatedPosts.length ) { return; } jprp.response = response; var html, showThumbnails, options = {}; if ( 'undefined' !== typeof wp && wp.customize ) { showThumbnails = wp.customize.instance( 'jetpack_relatedposts[show_thumbnails]' ).get(); options.showDate = wp.customize.instance( 'jetpack_relatedposts[show_date]' ).get(); options.showContext = wp.customize.instance( 'jetpack_relatedposts[show_context]' ).get(); options.layout = wp.customize.instance( 'jetpack_relatedposts[layout]' ).get(); } else { showThumbnails = response.show_thumbnails; options.showDate = response.show_date; options.showContext = response.show_context; options.layout = response.layout; } html = ! showThumbnails ? jprp.generateMinimalHtml( response.items, options ) : jprp.generateVisualHtml( response.items, options ); $relatedPosts.append( html ); jprp.setVisualExcerptHeights(); if ( options.showDate ) { $relatedPosts.find( '.jp-relatedposts-post-date' ).show(); } $relatedPosts.show(); $( '#jp-relatedposts a.jp-relatedposts-post-a' ).click(function() { this.href = jprp.getTrackedUrl( this ); }); } ); } $( function() { if ( 'undefined' !== typeof wp && wp.customize ) { if ( wp.customize.selectiveRefresh ) { wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) { if ( 'jetpack_relatedposts' === placement.partial.id ) { startRelatedPosts(); } } ); } wp.customize.bind( 'preview-ready', startRelatedPosts ); } else { startRelatedPosts(); } } ); })(jQuery); // source --> https://h-magonotedo.com/wp-content/plugins/page-transition/js/jquery.animsition.min.js?ver=1.3 /*! * animsition v3.2.1 * http://blivesta.github.io/animsition/ * Licensed under MIT * Author : blivesta * http://blivesta.com/ */ (function($){"use strict";var namespace="animsition";var methods={init:function(options){options=$.extend({inClass:"fade-in",outClass:"fade-out",inDuration:1500,outDuration:800,linkElement:".animsition-link",touchSupport:true,loading:true,loadingParentElement:"body",loadingClass:"animsition-loading",unSupportCss:["animation-duration","-webkit-animation-duration","-o-animation-duration"]},options);var support=methods.supportCheck.call(this,options);if(support===false){if(!("console"in window)){window.console={};window.console.log=function(str){return str}}console.log("Animsition does not support this browser.");return methods.destroy.call(this)}var bindEvts="click."+namespace;if(options.touchSupport){bindEvts+=" touchend."+namespace}if(options.loading===true){methods.addLoading.call(this,options)}return this.each(function(){var _this=this;var $this=$(this);var $window=$(window);var data=$this.data(namespace);if(!data){options=$.extend({},options);$this.data(namespace,{options:options});$window.on("load."+namespace,function(){methods.pageIn.call(_this)});$window.on("unload."+namespace,function(){});$(options.linkElement).on(bindEvts,function(event){event.preventDefault();var $self=$(this);methods.pageOut.call(_this,$self)})}})},supportCheck:function(options){var $this=$(this);var props=options.unSupportCss;var propsNum=props.length;var support=false;if(propsNum===0){support=true}for(var i=0;i
')},removeLoading:function(){var $this=$(this);var options=$this.data(namespace).options;var $loading=$(options.loadingParentElement).children("."+options.loadingClass);$loading.remove()},pageInClass:function(){var $this=$(this);var options=$this.data(namespace).options;var thisInClass=$this.data("animsition-in");var inClass;if(typeof thisInClass==="string"){inClass=thisInClass}else{inClass=options.inClass}return inClass},pageInDuration:function(){var $this=$(this);var options=$this.data(namespace).options;var thisInDuration=$this.data("animsition-in-duration");var inDuration;if(typeof thisInDuration==="number"){inDuration=thisInDuration}else{inDuration=options.inDuration}return inDuration},pageIn:function(){var _this=this;var $this=$(this);var options=$this.data(namespace).options;var inClass=methods.pageInClass.call(_this);var inDuration=methods.pageInDuration.call(_this);if(options.loading===true){methods.removeLoading.call(_this)}$this.css({"animation-duration":inDuration/1e3+"s"}).addClass(inClass);setTimeout(function(){$this.removeClass(inClass).css({opacity:1})},inDuration)},pageOutClass:function($self){var $this=$(this);var options=$this.data(namespace).options;var selfOutClass=$self.data("animsition-out");var thisOutClass=$this.data("animsition-out");var outClass;if(typeof selfOutClass==="string"){outClass=selfOutClass}else if(typeof thisOutClass==="string"){outClass=thisOutClass}else{outClass=options.outClass}return outClass},pageOutDuration:function($self){var $this=$(this);var options=$this.data(namespace).options;var selfOutDuration=$self.data("animsition-out-duration");var thisOutDuration=$this.data("animsition-out-duration");var outDuration;if(typeof selfOutDuration==="number"){outDuration=selfOutDuration}else if(typeof thisOutDuration==="number"){outDuration=thisOutDuration}else{outDuration=options.outDuration}return outDuration},pageOut:function($self){var _this=this;var $this=$(this);var url=$self.attr("href");var outClass=methods.pageOutClass.call(_this,$self);var outDuration=methods.pageOutDuration.call(_this,$self);$this.css({"animation-duration":outDuration/1e3+"s"}).addClass(outClass);setTimeout(function(){location.href=url},outDuration)},destroy:function(){return this.each(function(){var $this=$(this);$(window).unbind("."+namespace);$this.removeClass(namespace).removeData(namespace)})}};$.fn.animsition=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof method==="object"||!method){return methods.init.apply(this,arguments)}else{$.error("Method "+method+" does not exist on jQuery."+namespace)}}})(jQuery);